<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <script src="https://cdn.jsdelivr.net/npm/axios/dist/axios.min.js"></script>
</head>

<body>
    <script>
        function* cityGenerator() {
            yield axios('http://hmajax.itheima.net/api/city?pname=广东省')
            yield axios('http://hmajax.itheima.net/api/city?pname=北京')
        }
        //创建一个generator对象
        const city = cityGenerator()
        city.next().value.then(res => {
            console.log(res)
            return city.next().value
        }).then(res => {
            console.log(res)
        })
    </script>
</body>

</html>